// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import com.nokia.meego 1.1
Rectangle{
    id: rectangle_content
    width: 500
    height: 100
    anchors.right: parent.right
    anchors.left: parent.left
    color: "transparent"
//            color: ListView.isCurrentItem ? "black" : "red"
    MouseArea{
        id:main_mouse
        anchors.leftMargin: 0
        anchors.rightMargin: 0
        anchors.top: parent.top
        anchors.bottom: parent.bottom
        anchors.left: parent.left
        anchors.right: button_go.left
    }

    Image {
        id: image
        state: page.state = "normal"
        anchors.left: parent.left
        fillMode: Image.PreserveAspectFit
        source: icon_img
        width: 70
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 0
        anchors.top: rectangle_title.bottom
        anchors.topMargin: 0
        states: [
            State {
                name: "delete"
                PropertyChanges { target: image; source: "qrc:/delete"}
            },
            State {
                name: "normal"
                PropertyChanges { target: image;source: icon_img}
            }
        ]
    }
    Text{
        id:number
        visible: false
        opacity: 0
        text: file_number
    }
    Rectangle{
        id: rectangle_title
        height: 30
        anchors.right: parent.right
        anchors.left: parent.left
        anchors.leftMargin: 0
        color: "gray"
        opacity: 0.6
        Text {
            id: title
            text: titre
            anchors.top: parent.top
            anchors.topMargin: 0
            anchors.left: parent.left
            anchors.bottom: parent.bottom
            font.pixelSize: 23
            font.bold: true
        }
    }
    Text {
        id: subTitle
        text: qsTr("Size:") + size +"Mb\n"+
              qsTr("Modified") + modified +"\n"

        anchors.leftMargin: 0
        anchors.rightMargin: 0
        anchors.left: image.right
        anchors.top: rectangle_title.bottom
        anchors.right: button_go.left
        font.pixelSize: 20
    }
    Rectangle{
        id: button_go
        color: "transparent"
        width: 40
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 0
        anchors.top: rectangle_title.bottom
        anchors.topMargin: 0
        anchors.right: parent.right
        anchors.rightMargin: 0

        Text {
            id: text_button
            text: qsTr(">")
            font.pointSize: 15
            font.bold: false
            anchors.verticalCenter: parent.verticalCenter
        }

        MouseArea{
            id:go_mouse
            anchors.fill: parent
            onClicked: {
                console.debug(title.text);
                if(file)
                {
                    ftpManager.downloadFile(title.text);
                    console.debug("Type = File");
                    Script.time_debut = Qt.formatDateTime(new Date(), "hhmmss");

                }
                else
                {
                    ftpManager.Cd(title.text);
                    console.debug("[QML] ------ Directory --------");
                    console.debug("Go to " + title.text)
                    Script.addArray(title.text)
//                            Script.directoryName. = title.text
                    console.debug("[QML] ------ ------- --------");
                    loading();
                }
            }
        }
    }

}

